

package com.hazelcast.nio.serialization;

/**
 * Defines the name, type and index of a field.
 */
public interface FieldDefinition {

    /**
     * @return field type
     */
    FieldType getType();

    /**
     * @return field name
     */
    String getName();

    /**
     * @return field index
     */
    int getIndex();

    /**
     * @return factory ID of this field's class
     */
    int getFactoryId();

    /**
     * @return class ID of this field's class
     */
    int getClassId();

    /**
     * @return version of this field's class
     */
    int getVersion();

    /**
     * @return portable ID of this field's class
     * @since 5.4
     */
    default PortableId getPortableId() {
        return new PortableId(getFactoryId(), getClassId(), getVersion());
    }
}
